<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <div>
        <p>我是p标签</p>
    </div>
    <script>
        var oDiv = document.querySelector('div');
        var op = document.querySelector('p');

        var newNode1 = document.createElement('span');
        newNode1.innerHTML = '1111';
        oDiv.insertBefore(newNode1, op);

        var newNode2 = document.createElement('span');
        newNode2.innerHTML = '222';

        oDiv.appendChild(newNode2);
    </script>
</body>
</html>